<?php
/**
 * Description of accountservice
 *
 * @author laimis
 */

class AccountService {


    public $accountDAO;

    public function save($account){
        if($account->id != null){
            return $this->update($account);
        }else{
            return $this->insert($account);
        }
    }

    public function getByName($nickname){
        return $this->accountDAO->getByName($nickname);
    }

    public function getAll(){
        return $this->accountDAO->getAll();
    }

    public function getById($id){
        return $this->accountDAO->getById($id);
    }

    public function insert($account){
        return $this->accountDAO->insert($account);
    }

    public function update($account){
        $this->accountDAO->update($account);
    }
  
	/*
	 * @method atnaujinamas $city objekta
	 * @param $city objektas
	 */
    
	public function isAdmin($id){
		return $this->accountDAO->isAdmin($id);
	}

    public function delete($id){
        $this->accountDAO->delete($id);
    }

    public function AccountService(){
        include_once BASEDAO;
        include_once ACCOUNTDAO;
        include_once ACCOUNTENTITY;
        $this->accountDAO = new AccountDAO();
    }
}
?>
